import 'package:flutter/material.dart';

//第一种写法
// void main() {
//   runApp(MyApp());
// }

//箭头函数的另一种写法
void main() => runApp(MyApp());

//自定义组件
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // MaterialApp是根组件
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Container'),
        ),
        body: HomeContent(),
      ),
      theme: ThemeData(primaryColor: Colors.blue),
    );
  }
}

//自定义内容组件
class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //把container当成div?
    return Container(
      child: Text("文本"),
      //外边距，线框外侧边距
      margin: EdgeInsets.all(10),
      //内边距，线框内侧边距，可以看文本离线框的距离
      padding: EdgeInsets.all(10),
      //位移
      // transform: Matrix4.translationValues(100, 2, 3),
      transform: Matrix4.rotationZ(-0.5),
      //控制container中的子组件位置，看Text组件显示位置
      alignment: Alignment.bottomRight,
      height: 300,
      width: 300,
      decoration: BoxDecoration(
          color: Colors.amber,
          border: Border.all(color: Colors.black, width: 2.0),
          borderRadius: BorderRadius.all(Radius.circular(16.0))),
    );
  }
}
